home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 4 / Mac Giga-ROM 4.0 - 1993.toast / FILES / EDU / R-Z / WECatalog_Demo / Whole Earth Catalog_stack / stack_-1.xml < prev    next >
Encoding:
Extensible Markup Language  |  1987-09-21  |  4.0 KB  |  16 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
  3. <stack>
  4.     <name>in</name>
  5.     <id>-1</id>
  6.     <cardCount>20</cardCount>
  7.     <cardID>2944</cardID>
  8.     <listID>2093</listID>
  9.     <cantModify><false /></cantModify>
  10.     <cantDelete><false /></cantDelete>
  11.     <cantAbort><false /></cantAbort>
  12.     <cardSize>
  13.         <width>512</width>
  14.         <height>342</height>
  15.     </cardSize>
  16.     <script>on idle
  17. set lockscreen to false
  18. end idle
  19. function getLine fileName
  20. -- read one line from the file
  21. read from file fileName until return
  22. put it into msg
  23. return (it)
  24. end getLine
  25. function terminator thisLine
  26. -- is thisLine a message terminator?
  27. global terminators
  28. if char 1 to 5 of thisLine is "Topic" and char 10 of thisLine is ":" ¬¨
  29. then return true
  30. repeat with i = 1 to number of lines in terminators
  31. if line i of terminators is in thisLine then return true
  32. end repeat
  33. return false
  34. end terminator
  35. function getNum thisLine
  36. -- crack the leading number from a contents line
  37. put offset(":", thisLine) into endHere
  38. return value(char 1 to endHere - 1 of thisLine)
  39. end getNum
  40. function insertLine theField,thisNum,thisLine
  41. -- figure out where the new line should go in contents
  42. -- blank contents?
  43. if bkgnd field theField is empty then
  44. put thisLine into bkgnd field theField
  45. return 1
  46. end if
  47. -- at end? (the most common case - checked first)
  48. if getNum(last line of bkgnd field theField) < thisNum then
  49. put thisLine after bkgnd field theField
  50. return number of lines in bkgnd field theField
  51. end if
  52. -- all right, do it the hard way
  53. repeat with i = 1 to number of lines in bkgnd field theField
  54. if thisNum < getNum(line i of bkgnd field theField) then
  55. put thisLine before line i of bkgnd field theField
  56. return i
  57. end if
  58. end repeat
  59. end insertLine
  60. on addText newText
  61. -- concatenate to global text object, observing size limit
  62. global theText, textLength
  63. add length(newText) to textLength
  64. if textLength > 29990 then exit addText
  65. put newText after theText
  66. end addText
  67. function slurpText fileName,discard,putHere
  68. -- skip null lines, build message, paste into card
  69. -- return terminating line for analysis
  70. global theText, textLength
  71. repeat discard
  72. put getline(fileName) into foo
  73. end repeat
  74. put empty into theText
  75. put 0 into textLength
  76. repeat
  77. -- pull in the message text
  78. -- done offscreen for performance reasons (no redraws)
  79. put getLine(fileName) into theLine
  80. if terminator(theLine) then exit repeat
  81. addText theLine
  82. end repeat
  83. put theText into bkgnd field putHere
  84. return theLine
  85. end slurpText
  86. on setID topicID,idLine
  87. -- put id of this card into hidden link field of topic header card
  88. if idLine is 0 then exit setID
  89. get the id of this card
  90. put it into line idLine of field "theLinks" of card id (word 3 of topicID)
  91. end setID
  92. on import
  93. -- don't try to understand the details without a WELL transcript!
  94. global terminators
  95. ask "Please enter name of text file:"
  96. if it is empty then exit import
  97. put it into fileName
  98. open file fileName
  99. put "Interrupt!" & return & "(r)espond" & return & "responses total."¬¨
  100. into terminators
  101. repeat
  102. put getLine(fileName) into theLine
  103. if theLine is empty then exit repeat
  104. repeat while char 1 to 5 of theLine is "Topic" ¬¨
  105. and char 10 of theLine is ":"
  106. delete last char of theLine
  107. delete char 11 of theLine
  108. delete char 1 to 5 of theLine
  109. put getNum(theLine) into topicNum
  110. put topicNum into char 1 to 4 of theLine
  111. if theLine is not in field "theTopics" of card "Conference" then
  112. -- There is no Topic line in the Conference card
  113. go to card "Conference"
  114. put char 1 to 65 of theLine & return into theLine
  115. put insertLine("theTopics", topicNum, theLine) into foo
  116. end if
  117. put theLine into topicLine
  118. go to card ("Topic" & topicNum) of bkgnd "Topic"
  119. if the result is not empty then
  120. -- There is no Topic header card for this topic
  121. go to card 1 of bkgnd "Topic"
  122. doMenu Copy Card
  123. go to last card
  124. doMenu Paste Card
  125. set the name of this card to "Topic" & topicNum
  126. put theLine into bkgnd field "theTopic"
  127. -- read author line
  128. put getLine(fileName) into theLine
  129. if char 1 to 4 of theLine is "By: " then
  130. -- This is originator's message
  131. delete char 1 to 4 of theLine
  132. put offset("